<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2022/6/10
  Time: 14:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="com.bwf.pojo.Student" %>
<%@ page import="java.time.LocalDate" %>
<%@ page import="java.time.LocalDateTime" %>
<%@ page import="java.util.Date" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<c:set var="name" value="zhangsan" scope="request"></c:set>
<c:if test="${name eq 'zhangsan'}">
    <h3>欢迎：${name}</h3>
</c:if>

<c:set var="salary" value="5000" scope="request"></c:set>
<c:choose>
    <c:when test="${salary > 20000}">
        <h3>高级开发</h3>
    </c:when>
    <c:when test="${salary > 10000 && salary < 20000}">
        <h3>中级开发</h3>
    </c:when>
    <c:when test="${salary > 6000 && salary < 10000}">
        <h3>初级开发</h3>
    </c:when>
    <c:otherwise><h3>实习</h3></c:otherwise>
</c:choose>

<%
    ArrayList<Student> list = new ArrayList<Student>();
    list.add(new Student("张三", 20, 1, new Date(), 12000.119));
    list.add(new Student("李四", 30, 0, new Date(), 11000.159));
    list.add(new Student("王五", 50, 1, new Date(), 13000.169));
    list.add(new Student("赵六", 50, 1, new Date(), 14000.129));
    request.setAttribute("list", list);
%>
<hr/>
<c:forEach var="stu" items="${list}" varStatus="vs">
    <h5>姓名: ${stu.name}</h5>
    <h5>年龄: ${stu.age}</h5>
    <c:if test="${stu.sex == 1}"><h5>性别: 男</h5></c:if>
    <c:if test="${stu.sex eq 0}"><h5>性别: 女</h5></c:if>
    <h5>生日: <f:formatDate value="${stu.birthday}" pattern="yyyy-MM-dd HH:mm:ss"></f:formatDate></h5>
    <h5>工资: <f:formatNumber value="${stu.salary}" pattern="0.00"></f:formatNumber></h5>
    <h6>first：${vs.first} | last：${vs.last} | count：${vs.count} | current：${vs.current} | index：${vs.index}</h6>
</c:forEach>
</body>
</html>
